package Box_List;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Test9 {
	public static void main(String[] args) {
		Test9 d = new Test9();
		d.MUI();
	}
	
	void MUI() {
		JFrame frame = new JFrame("边框1");
		String[] purposeNames = { "hao", "2", "3" };
		JComboBox purposeBox = new JComboBox(purposeNames);
		purposeBox.setSelectedIndex(-1);
		purposeBox.setEditable(false);
		purposeBox.setBounds(new Rectangle(20, 29, 395, 122));
		
		//purposeBox.addMouseListener(new MouseListener() {});
		//purposeBox.addFocusListener(new FocusListener() {});
		purposeBox.addItemListener(new ItemListener() {
			public void itemStateChanged( ItemEvent e) {
				//System.out.println("目的");
				 if (e.getStateChange()== ItemEvent.SELECTED) {
					 System.out.print("Item=" + e.getItem());
					 System.out.println("    StateChange=" + e.getStateChange());
				 }
			}
		});

		JPanel jpanel = new JPanel();
		jpanel.add(purposeBox);
		jpanel.setSize(560, 190);
		frame.setLocation(200, 100);
		frame.add(jpanel);
		frame.setSize(600, 200);
		frame.setVisible(true);
	}
}
